package com.sb.registration.component.model;

import java.io.Serializable;

/**
 * Class to provide error information for user registration service method requests.
 * 
 * @author gautam.amitkumar@gmail.com
 *
 */
public class ErrorDetails implements Serializable {
	
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -2151847218238677846L;

	/**
	 * Error Code value.
	 */
	private int errorCode;

	/**
	 * Error Message having description about error.
	 */
	private String errorMessage = "";
	
	
	/**
	 * Exception Message.
	 */
	private String exceptionMessage = "";

	public int getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(int errorCode) {
		this.errorCode = errorCode;
	}

	public String getErrorMessage() {
		return errorMessage;
	}

	public void setErrorMessage(String errorMessage) {
		this.errorMessage = errorMessage;
	}

	public String getExceptionMessage() {
		return exceptionMessage;
	}

	public void setExceptionMessage(String exceptionMessage) {
		this.exceptionMessage = exceptionMessage;
	}

	@Override
	public String toString() {
		return "ErrorDetails [errorCode=" + errorCode + ", errorMessage="
				+ errorMessage + ", exceptionMessage=" + exceptionMessage + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + errorCode;
		result = prime * result
				+ ((errorMessage == null) ? 0 : errorMessage.hashCode());
		result = prime
				* result
				+ ((exceptionMessage == null) ? 0 : exceptionMessage.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ErrorDetails other = (ErrorDetails) obj;
		if (errorCode != other.errorCode)
			return false;
		if (errorMessage == null) {
			if (other.errorMessage != null)
				return false;
		} else if (!errorMessage.equals(other.errorMessage))
			return false;
		if (exceptionMessage == null) {
			if (other.exceptionMessage != null)
				return false;
		} else if (!exceptionMessage.equals(other.exceptionMessage))
			return false;
		return true;
	}
	
}
